package swingxrcp.framework.server.action;

import java.io.Serializable;

import swingxrcp.framework.model.Action;

/**
 * Action拦截器代理
 *
 * @author liangfei
 *
 */
public class ActionProxy implements Action {

	private final ActionInterceptor actionInterceptor;

	private final Action action;

	public ActionProxy(ActionInterceptor actionInterceptor, Action action) {
		if (actionInterceptor == null)
			throw new NullPointerException("actionInterceptor == null");
		if (action == null)
			throw new NullPointerException("action == null");
		this.actionInterceptor = actionInterceptor;
		this.action = action;
	}

	public Serializable execute(Serializable object) {
		return actionInterceptor.intercept(action, object);
	}

}
